<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <#include "../common/header.ftl"/>

    <script>
        $(function () {
            $(".changeState").click(function () {
                var state = $(this).data("state")
                var id = $(this).data("id")
                $.get("/travel/changeState.do", {id: id, state: state}, function (data) {
                    if (data.success) {
                        window.location.reload();
                    } else {
                        $.messager.alert(data.msg)
                    }
                })
            })

            $(".checkContent").click(function () {
                var id = $(this).data("id")
                $.get("/travel/getContent.do", {id: id}, function (data) {
                        $(".modal-body").html(data.travelContent.content)
                        $("#contentModal").modal("show")
                })
            })


        })
    </script>
    <style>
        #contentModal img{
            width: 100%;
        }
        #contentModal {
            max-height: 500px;  //最大高度
            overflow-y: auto;   //超过最大高度,自动滚动
        }
    </style>

</head>
<body>

<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl"/>
    <div class="row">
        <div class="col-sm-3">
        <#--设置当前要回显当前菜单,必须在载人菜单前完成设置-->
            <#assign menu="travel"/>
            <#include "../common/menu.ftl"/>
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">待发布管理</h1>
                </div>
            </div>
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="" method="post">
                <input type="hidden" id="currentPage" name="currentPage" value="1">
                <div class="form-group">
                    <label>关键字:</label>
                    <input type="text" class="form-control" name="keyword" value="${(qo.keyword)!}"
                           placeholder="请输入标题">
                </div>

                <button id="btn_query" class="btn btn-info">
                    <span class="glyphicon glyphicon-search"></span> 查询
                </button>
            </form>

            <table class="table table-striped table-hover">
                <tr>
                    <th>标题</th>
                    <th>封面</th>
                    <th>地点</th>
                    <th>作者</th>
                    <th>状态</th>
                    <th></th>
                </tr>
                <#list pageInfo.list as entity>
                    <tr>
                        <td>${entity.title!}</td>
                        <td><img src="${entity.coverUrl!}" width="30px"></td>
                        <td>${(entity.place.name)!}</td>
                        <td>${(entity.author.nickName)!}</td>
                        <td>${entity.stateName!}</td>
                        <td>
                            <a href="javaScript:;" class="changeState" data-id="${entity.id}" data-state="3">发布</a>
                            <a href="javaScript:;" class="changeState" data-id="${entity.id}" data-state="0">拒绝</a>
                            <a href="javaScript:;" class="checkContent" data-id="${entity.id}">查看文章</a>
                        </td>
                    </tr>
                </#list>
            </table>
           <#include "../common/page.ftl"/>
        </div>
    </div>
</div>


<!-- 内容显示（Modal） -->
<div class="modal fade" id="contentModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    编辑
                </h4>
            </div>
            <div class="modal-body">

            </div>
        </div>
    </div>
</div>
</body>
</html>